/*
 * main.java
 *
 * Created on 1 de agosto de 2006, 04:19 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package ig.util.main;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 * @author jsanchez
 */
public class Main {
    
    private static String FECHA[]=new String[3];
    
    /** Creates a new instance of main */
    public Main() {
    }
    
//
//    public static Timestamp getDate(java.util.Calendar.DATE,int cantidad){
//        Calendar cal = Calendar.getInstance();
//        cal .setTimeInMillis()
//        cal.add(campo,cantidad);
//        SimpleDateFormat df= new SimpleDateFormat(FORMATO_FECHA);
//        try{
//            return Timestamp.valueOf(df.format(cal.getTime()));
//        }catch(Exception e){
//            e.printStackTrace();
//            return null;
//        }
//    }
    
    public static void main(String arg[]){
        System.out.print("|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}        
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}        
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}        
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}        
        System.out.print("\r|");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r/");
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r-");        
        try {Thread.sleep(100);} catch (Exception exception) {}
        System.out.print("\r\\");        
        try {Thread.sleep(100);} catch (Exception exception) {}                
//        String textFiel="<textField isStretchWithOverflow=\"false\" isBlankWhenNull=\"false\" evaluationTime=\"Now\" hyperlinkType=\"None\"  hyperlinkTarget=\"Self\" >" +
//                "        <reportElement" +
//                "                x=\"_X_\"" +
//                "                y=\"0\"" +
//                "                width=\"107\"" +
//                "                height=\"15\"" +
//                "                key=\"textField-4\"" +
//                "                positionType=\"FixRelativeToBottom\"/>" +
//                "        <box topBorder=\"1Point\" topBorderColor=\"#000000\" leftBorder=\"1Point\" leftBorderColor=\"#000000\" rightBorder=\"None\" rightBorderColor=\"#000000\" bottomBorder=\"1Point\" bottomBorderColor=\"#000000\"/>" +
//                "        <textElement textAlignment=\"Right\">" +
//                "                <font/>" +
//                "        </textElement>" +
//                "<textFieldExpression   class=\"_CLASS_\"><![CDATA[$P{_VALOR_}]]></textFieldExpression>" +
//                "</textField>" +
//                "<!--TEXTFIELD-->";
//        String a="<!--TEXTFIELD0-->";
//        System.out.println(textFiel.replaceAll(a,textFiel));
//        Long dia=Long.valueOf("86400000");
//        System.out.println("'2006-01-31'".substring(1,11));
//        java.sql.Date fecha1=java.sql.Date.valueOf("'2006-01-31'".substring(1,11));
//        System.out.println(fecha1);
//        fecha1.setTime(fecha1.getTime()+dia*365);
//        System.out.println(fecha1);
//
//        Calendar cal = Calendar.getInstance();
//        cal.setTimeInMillis(fecha1.getTime());
//
////        System.out.println(cal.get(java.util.Calendar.MILLISECOND));
//
//        cal.add(java.util.Calendar.DATE,-0);
//
//        SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd 00:00:00.000000000");
//
//        System.out.println(Timestamp.valueOf(df.format(cal.getTime())));
//        cal.setTimeInMillis(cal.getTimeInMillis()+(dia*365));
//        System.out.println(Timestamp.valueOf(df.format(cal.getTime())));
        
        
//        System.out.println(1000*60*60*24);
//        String[] s={
//            "ACCIONES","ADICONTRATOSRENTABILIDAD","BALANCE","BANDASLIQUIDEZ","BANDASVAR",
//            "CALCULOSRENTABILIDADCONTRATOS","CAMBIOESPERADOMONEDAS","CONTRATOS","CONTRATOSSIMPLES",
//            "CUENTAS","EMISORES","EMPRESAS","ESPECIES","FLUJOS","FLUJOSLIQUIDEZ","LIBROS","MONEDAS","POSICIONESACCIONES",
//            "POSICIONESESPECIES","PRODUCTOS","RELACIONACCIONESSUBCUENTAS","RELACIONBALANCESUBCUENTA","RELACIONESPECIESSUBCUENTAS",
//            "RELACIONMONEDASSUBCUENTAS","RELACIONSUBCUENTASPRODUCTOS","TASAS","TASASDEPAGOS","UNIDADESNEGOCIOS",
//            "VALORESCONTRATOS","VALORESMONEDAS","VALORESTASAS","VARCONTRATOSPRECIO","VARCONTRATOSTASA"
//        };
//
//        System.out.println(new Date(new Long("9999999999999")));
        
        
/////////---------------------------------------------------------------
//        java.util.Date f1 = new java.util.Date(java.sql.Timestamp.valueOf("2007-01-01 00:00:00.00").getTime());
//        java.util.Date f2 = new java.util.Date(java.sql.Timestamp.valueOf("2006-01-01 00:00:00.00").getTime());
//
//        Calendar fecha1=Calendar.getInstance();
//        fecha1.setTime(f1);
//
//        Calendar fecha2=Calendar.getInstance();
//        fecha2.setTime(f2);
//        /////////
//
//        Integer YEAR1=fecha1.get(Calendar.YEAR);
//        Integer YEAR2=fecha2.get(Calendar.YEAR);
//        Integer MONTH1=fecha1.get(Calendar.MONTH);
//        Integer MONTH2=fecha2.get(Calendar.MONTH);
//        Integer DAY_OF_MONTH1=fecha1.get(Calendar.DAY_OF_MONTH);
//        Integer DAY_OF_MONTH2=fecha2.get(Calendar.DAY_OF_MONTH);
//
//        System.out.print("YEAR1:"+YEAR1);
//        System.out.print(" MONTH1:"+MONTH1);
//        System.out.print(" DAY_OF_MONTH1:"+DAY_OF_MONTH1);
//        System.out.println("");
//        System.out.print("YEAR1:"+YEAR2);
//        System.out.print(" MONTH1:"+MONTH2);
//        System.out.print(" DAY_OF_MONTH1:"+DAY_OF_MONTH2);
//        System.out.println("");
//
//        //alteramos el dia para ver el comportamiento del calendario
//        fecha1.set(Calendar.DAY_OF_MONTH,fecha1.get(Calendar.DAY_OF_MONTH)+1);
//        Integer nuevoMes=fecha1.get(Calendar.MONTH);
//        Integer nuevoAnio=fecha1.get(Calendar.YEAR);
//        Boolean cambioMes=!nuevoMes.equals(MONTH1)?true:false;
//        Boolean cambioAnio=!nuevoAnio.equals(YEAR1)?true:false;
//
//        Boolean ultimoDiaDelMesFecha1=(cambioMes || cambioAnio)?true:false;
//        YEAR2=(YEAR1-YEAR2)*360;
//        DAY_OF_MONTH2=(ultimoDiaDelMesFecha1?30:DAY_OF_MONTH1)-DAY_OF_MONTH2;
//
//        MONTH2=(MONTH1-MONTH2)*30;
//
//        System.out.println(YEAR2);
//        System.out.println(MONTH2);
//        System.out.println(DAY_OF_MONTH2);
//        System.out.println("Dias:"+(YEAR2+DAY_OF_MONTH2+MONTH2));
//
//        Integer plazo=(YEAR2+DAY_OF_MONTH2+MONTH2);
//        Integer FRECUENCIA=2;
//        plazo=plazo%(FRECUENCIA*30)>0?(plazo/FRECUENCIA)+1:plazo/FRECUENCIA;
//
//        Calendar c=Calendar.getInstance();
//        c.setTimeInMillis(java.sql.Date.valueOf("2006-01-01").getTime());
//        System.out.println(c.getTime());
//
//
//        c.set(Calendar.MONTH,c.get(Calendar.MONTH)-FRECUENCIA);
//        System.out.println(c.getTime());
//        System.out.println(new java.sql.Timestamp(c.getTimeInMillis()));
        
//********************************************************************************************
//        System.out.println(java.sq+l.Timestamp.valueOf("2006-02-31 00:00:00.00"));
        
        
//        System.out.println(fechainicio1.getTime());
//        System.out.println(fechainicio2.getTime());
//        fechainicio1.setTime(fechainicio1.getTime()-(fechainicio1.getTime()-fechainicio1.getTime()));
//        System.out.println("");
//        System.out.println(fechainicio1);
//        PlanesAmortizacion plan= new PlanesAmortizacion(true);
//        plan.setTipoFrecuencia(2);
//       //double interes=2.1322/100;
//        Double interes=12.0/100;
//        //Double tasas=Conversiones.efectivoAnualAPeriododVencido(interes,0,IFrecuencias.MENSUAL*30);
//        Double tasa=interes;
//        System.out.println("tasas:"+tasa);
//        Double monto=9600000.0;
//	int plazo=8;
//        plan.calcularPlanCuotaFijaTasaFija(
//                monto,
//                tasa,
//                plazo,
//                IModalidad.VENCIDA,
//                IFrecuencias.MENSUAL,
//                IFrecuencias.MENSUAL,
//                IFrecuencias.MENSUAL
//                );
        
        
//        ***************
//        StringTokenizer fechaToken= new StringTokenizer("2006-02-06","-") ;
//
//        fechaToken= new StringTokenizer("06-02-2006","-");
//        try {
//            FECHA[0]=(String) fechaToken.nextElement();
//            FECHA[1]=(String) fechaToken.nextElement();
//            FECHA[2]=(String) fechaToken.nextElement().toString().substring(0,4);
//        } catch (Exception e) {
//            fechaToken= new StringTokenizer("2006-02-06","-") ;
//            FECHA[2]=(String) fechaToken.nextElement().toString().substring(0,4);
//            FECHA[1]=(String) fechaToken.nextElement();
//            FECHA[0]=(String) fechaToken.nextElement();
//        }finally {
//            System.out.println("aja");
//        }
//
//        System.out.println(FECHA[0]+","+FECHA[1]+","+FECHA[2]);
//
//        Timestamp t=new Timestamp(new Date(FECHA[1]+"/"+FECHA[0]+"/"+FECHA[2]).getTime());
//        System.out.println(t);
//        Timestamp fecha2=new Timestamp(fecha1.getTime());
//        fecha1.setDate(fecha2.getDate()+4);
//        System.out.println(new java.sql.Date(fecha1.getTime()));
//
//        Double valor=1000.0;
//        System.out.println((valor*50)/100);
        
        
        
        
//        try {
//            new Main().lookupAccionesFlujosSBBean().findByFechaCorte(new java.sql.Date(123456));
//        } catch (RemoteException ex) {
//            ex.printStackTrace();
//        } catch (FinderException ex) {
//            ex.printStackTrace();
//        }
    }
    
//    public ig.ejb.metrica.da.session.AccionesFlujosSBRemote lookupAccionesFlujosSBBean() {
//        try {
//            Properties prop = new Properties();
//            prop.put( Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
//            String Sockec = "192.168.0.1:1099";
//            prop.put( Context.PROVIDER_URL, Sockec);
//            javax.naming.Context c = new javax.naming.InitialContext(prop);
//            Object remote = c.lookup("java:AccionesFlujosSBBean");
//            ig.ejb.metrica.da.session.AccionesFlujosSBRemoteHome rv = (ig.ejb.metrica.da.session.AccionesFlujosSBRemoteHome) javax.rmi.PortableRemoteObject.narrow(remote, ig.ejb.metrica.da.session.AccionesFlujosSBRemoteHome.class);
//            return rv.create();
//        }
//        catch(javax.naming.NamingException ne) {
//            java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
//            throw new RuntimeException(ne);
//        }
//        catch(javax.ejb.CreateException ce) {
//            java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce);
//            throw new RuntimeException(ce);
//        }
//        catch(java.rmi.RemoteException re) {
//            java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,re);
//            throw new RuntimeException(re);
//        }
//    }
    
}
